﻿using UnityEngine;
using UnityEditor;
using System.Collections;

public class GameObjectTools {

	#region //Active
	
	[MenuItem("Tools/GameObject/Active/Active Self")]
	public static void SetGameObjectActiveSelf()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.SetActive(true);
	}
	
	[MenuItem("Tools/GameObject/Active/Active Recursively")]
	public static void SetGameObjectActiveRecursively()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.SetActiveRecursively(true);
	}
	
	[MenuItem("Tools/GameObject/Active/UnActive Self")]
	public static void SetGameObjectUnActiveSelf()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.SetActive(false);
	}
	
	[MenuItem("Tools/GameObject/Active/UnActive Recursively")]
	public static void SetGameObjectUnActiveRecursively()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.SetActiveRecursively(false);
	}
	
	#endregion //Active
	
	#region //HideFlags
	
	[MenuItem("Tools/GameObject/HideFlags/DontSave")]
	public static void SetGameObjectsHideFlags_DontSave()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.hideFlags = HideFlags.DontSave;
	}
	
	[MenuItem("Tools/GameObject/HideFlags/HideAndDontSave")]
	public static void SetGameObjectsHideFlags_HideAndDontSave()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.hideFlags = HideFlags.HideAndDontSave;
	}
	
	[MenuItem("Tools/GameObject/HideFlags/HideInHierarchy")]
	public static void SetGameObjectsHideFlags_HideInHierarchy()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.hideFlags = HideFlags.HideInHierarchy;
	}
	
	[MenuItem("Tools/GameObject/HideFlags/HideInInspector")]
	public static void SetGameObjectsHideFlags_HideInInspector()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.hideFlags = HideFlags.HideInInspector;
	}
	
	[MenuItem("Tools/GameObject/HideFlags/NotEditable")]
	public static void SetGameObjectsHideFlags_NotEditable()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			obj.hideFlags = HideFlags.NotEditable;
	}
	
	#endregion //HideFlags
	
	#region //SetDirty
	[MenuItem("Tools/Object/Dirty(Then can commit to svn)")]
	public static void SetObjectsDirty()
	{
		GameObject[] objs = Selection.gameObjects;
		foreach(GameObject obj in objs)
			EditorUtility.SetDirty(obj);
	}
	
	#endregion //SetDirty
}
